package com.foreknow.tijian.service.Impl;

import com.foreknow.tijian.dao.FoodDao;
import com.foreknow.tijian.dao.Impl.FoodDaoImpl;
import com.foreknow.tijian.po.Food;
import com.foreknow.tijian.service.FoodService;
import com.foreknow.tijian.util.DBUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.List;

public class FoodServiceImpl implements FoodService {
    //建立连接
    Connection conn= DBUtil.getConnection();
    PreparedStatement pst;
    @Override
    public List<Food> listFoodByBusinessId(int businessId) {
        FoodDao foodDao = new FoodDaoImpl();
        List<Food> list=null;
        try{
            //调用Dao层的方法
            list=foodDao.listFoodByBusinessId(businessId);
        }
        catch(Exception e){
        }
        finally {
            //关闭资源
            DBUtil.close(pst);
        }
        return list;
    }
}
